package cn.itsource.fallback;

import cn.itsource.api.LoginRemoteApi;
import cn.itsource.constants.ErrorCode;
import cn.itsource.pojo.domain.Login;
import cn.itsource.result.JSONResult;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @program fccar
 * @Author luoc
 * @Date 2024/09/04 17:32
 * @Version 1.0.0
 * @Description
 */

@Component
public class LoginRemoteApifallbackFactory implements FallbackFactory<LoginRemoteApi> {

    @Override
    public LoginRemoteApi create(Throwable cause) {
        return new LoginRemoteApi() {
            @Override
            public JSONResult register(Login Login) {
                return JSONResult.error(ErrorCode.SERVICE_REQUEST_ERROR);
            }
        };
    }
}
